#!/usr/bin/env escript

main(_) ->
	io:format("~p", [count_even([1, 2, 9, 2, 3, 4, 6, 8, 7])]).
	
count_even([]) -> 0;
count_even([H|T]) ->
	IsEven = if 
		(H rem 2) =:= 0 -> 1;
		true -> 0
	end,
	IsEven + count_even(T).
% Wait till you see list comprehension later
																		